#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <gmp.h>
#include "montecarlo.h"

#define N_OUT 10
#define RANDS_BY_OUT 80000000
#define IT_FILENAME "resultados/seq"
#define F_PREC 33219314
   

int main (int argc, char** argv){
	unsigned int n = 0, t;
	int flag;
	RANDCORE rc;
	COUNTERS c;

	mpf_set_default_prec(F_PREC);

	init_randcore(&rc);
	init_counters(&c);

	t = time(NULL);
	
	while(N_OUT > n++){
		rc.n = RANDS_BY_OUT;
		while(rc.n--){
			flag = get_rand_point(&rc);
			add_count(&c, flag);
		}
		calc_pi(&c);
		printf("It %d - %u rands - %d segundos\n", n, n*RANDS_BY_OUT, (int) time(NULL)-t); 
		save_it(&c, IT_FILENAME);
	}
	clear_randcore(&rc);
	clear_counters(&c);

	return EXIT_SUCCESS;
}


